//package GUI;
//
//import java.awt.Dimension;
//import java.awt.GridLayout;
//import java.awt.Rectangle;
//import java.awt.event.ActionListener;
//import java.io.File;
//import java.io.FileNotFoundException;
//import java.io.FileOutputStream;
//import java.io.IOException;
//import java.io.OutputStream;
//import java.io.Serializable;
//
//import javax.swing.JFileChooser;
//import javax.swing.JPanel;
//import javax.swing.JLabel;
//import javax.swing.JScrollPane;
//import javax.swing.JTable;
//import javax.swing.JButton;
//import javax.swing.JComboBox;
//
//import Common.Course;
//
//
//public class ViewNewAssignmentScreen extends JPanel implements Serializable{
//   
//
//	
//	
//
//	public StudentMainMenu stmn = null;
//	public Login myLoginFrame = null;
//	public UserStudent user = null;
//
//   
//
//	public String cID;
//	
//	private String IsExceptional = "Exceptional request approved";
//    private int index=0;
//    String getAnsewrS = null;	
//    byte [] byteArray = null;
//    public String taskName=null;
//    public String deadLinee=null;
//    public byte [] willBeFIle=null;
//	private JFileChooser fs;	                  /// for saving a file menu
//	private JButton getFileButton=null;
//    
//	
//	private JComboBox selCourseCb = null;
//	private JButton downloadFileBtn = null;
//
//   
//	public JButton getDowonloadFIleBtn()
//	{
//		if(downloadFileBtn==null)
//		{
//			downloadFileBtn = new JButton("Download file");
//			
//		}
//		return downloadFileBtn;
//	}
//	
//	
//	
//	public ViewNewAssignmentScreen(StudentMainMenu stmn) {
//    	
//    	
//		setLayout(null);
//		
//		JComboBox comboBox = new JComboBox();
//		comboBox.setBounds(201, 120, 219, 22);
//		add(comboBox);
//		
//		JButton btnViewAssignment = new JButton("View Assignment");
//		btnViewAssignment.setBounds(493, 230, 115, 23);
//		add(btnViewAssignment);
//		
//		JLabel lblSelectCourse = new JLabel("Select course:");
//		lblSelectCourse.setBounds(102, 124, 68, 14);
//		add(lblSelectCourse);
//    	
//    }
//
//	
//    	
//    //	 user=new UserStudent();
//       
// 
//   
//       //getting ClassId 
//        String classID = stmn.user.StudentData.ClassId;
//
//        System.out.println("ViewNewAssignmentScreen q\n");
////        while (index<stmn.user.StudentData.ListOfCourses.lOfCourses.size()){				//	Getting all the couurse
//        	cID =stmn.user.StudentData.ListOfCourses.lOfCourses.get(index).getCid()+" ";	// index will tell how many courses there
////        	index++;																		// are for the Student
////             }
//        System.out.println("ViewNewAssignmentScreen\nClass ID IS : "+classID+"\nCid is : "+cID);
//  //      System.out.println("user test is :"+ user.test1);
//        ///do{ while there R more assignments    
//        
//        myLoginFrame.client.handleMessageFromClientUI("viewNewAssignmentDetails "+classID+" "+cID);
//        try {
////			while (stmn.wait){
//        	Thread.sleep(1000);
////        	System.out.println("LOOP  :");
////			}
//		} catch (InterruptedException e) {
//			System.out.println("ViewNewAssignmentScreen THREAD ");
//			e.printStackTrace();
//		}
//        
//        willBeFIle= stmn.getMyByteArr();
//        String a = stmn.getTaskNum();
//        String b = stmn.getDeadLine();
//        willBeFIle= stmn.getMyByteArr();
//
//        System.out.println("\nVVVVVVVVVV task num is : "+a+"\ndeadlin in : "+b+"\nwillBeFIle.length = : "+ willBeFIle.length);
//
//        //////////////////////////////////////
//        //making th listener
//        
//        
//        // open saving window and getting the path for saving
// try{       
//        int returnVal = fs.showSaveDialog(ViewNewAssignmentScreen.this);					///need a triger
//        if (returnVal == JFileChooser.APPROVE_OPTION) {
//            File pathFile = fs.getSelectedFile();
//            System.out.println("ERROR Saving the file");   
//        //making the a file
//    	OutputStream getfile = null;
//		try {
//			getfile = new FileOutputStream(pathFile.getAbsolutePath());
//		} catch (FileNotFoundException e) {
//            System.out.println("ERROR Saving the file 2");   
//			e.printStackTrace();
//		}	   
//    	try {
//			getfile.write(willBeFIle);
//		} catch (IOException e) {
//            System.out.println("ERROR Saving the file 3");   
//			e.printStackTrace();
//		}
//    	System.out.println(willBeFIle.length);
//    	try {
//			getfile.close();
//		} catch (IOException e) {
//			// TODO Auto-generated catch block
//			e.printStackTrace();
//		}
//        }
//        
// }catch (Exception e) {
//	 System.out.println("ERROR Saving the file");
//}
//        
//        
//        //////////////////////////////////////////////
//        
//   //     data[0][0]=a;//get assignment name from the DB that the teacher updated   
//	//	 data[0][1]=b;//get assignment final submission date
//	//	 data[0][2]="will be link";//Link to the file that the teacher checked and wrote her comments in the assignment file itself
//		// data[0][2]=//Link to the file that the teacher checked and wrote her comments in the assignment file itself
//        
//        
//        
//        //      myLoginFrame.client.handleMessageFromServer(getAnsewrS);
////        myLoginFrame.client.handleMessageFromClientUI("viewNewAssignmentFile "+classID+" "+cID);
////  //      myLoginFrame.client.handleMessageFromServer(byteArray);
////        try {
////			Thread.sleep(400000);
////		} catch (InterruptedException e) {
////			System.out.println("ViewNewAssignmentScreen THREAD ");
////			e.printStackTrace();
////		}
//        /////////////////////////////////
//        /////need to make wait!!!
//        
//   //    String a = myLoginFrame.us.getTaskNum();
//   //   System.out.println("Back in ViewNewAssignment getTaskNum is : "+a);
//      
//        
//        
//        
//        ////////////////////////////////////////////////////////////////////////////////////////////////////////
//        
//        
//
//    
//    	
//
//
//
//    	
//    	
//    
//    private void printDebugData(JTable table) {
//        int numRows = table.getRowCount();
//        int numCols = table.getColumnCount();
//        javax.swing.table.TableModel model = table.getModel();
// 
//        System.out.println("Value of data: ");
//        for (int i=0; i < numRows; i++) {
//            System.out.print("    row " + i + ":");
//            for (int j=0; j < numCols; j++) {
//                System.out.print("  " + model.getValueAt(i, j));
//            }
//            System.out.println();
//        }
//        System.out.println("--------------------------");
//    }
//	private JButton getFileButtonButton()
//	{
//		if(getFileButton==null)
//		{
//			getFileButton=new JButton();
//			getFileButton.setBounds(new Rectangle(54, 129, 172, 29));
//			getFileButton.setText("Login");
//			getFileButton.addActionListener(new java.awt.event.ActionListener()
//			{
//				public void actionPerformed(java.awt.event.ActionEvent e)
//				{
//					System.out.println("actionPerformed");
//					
//					 try {
//						
//						 myLoginFrame.client.openConnection();
//					 	 } catch (IOException e1)
//					 	 {
//					 		
//					 		 System.out.println("Failed to open a connection");
//					 		 e1.printStackTrace();
//					 	 }
//					 
//				}
//			});
//		}
//		return getFileButton;
//   }
//
//}
//
